package org.small.shop.phone.api.config.exception;

import javax.servlet.http.HttpServletRequest;

import org.small.shop.phone.api.utils.ShopJSONResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 全局异常处理器
 * 
 * @author admin 1.首先创建一个class类 2.必须加上注解@ControllerAdvice
 *         3.如果返回的错误结果是字符串，要加上注解@ResponseBody
 * 
 */
@ControllerAdvice
public class GlobalDefaultExceptionHandler {
	@ExceptionHandler(Exception.class)
	@ResponseBody
	public ShopJSONResult defaultExceptionHandler(HttpServletRequest request, Exception e) {

		return ShopJSONResult.errorMsg("系统繁忙");
	}
}
